<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<html>
<body>
<script type="text/javascript">
	$(document).ready(function(){
		$("#moneyType").val("${moneyType}");
	});
</script>
<form class="form-inline" action="" method="post">
<table>
<tr>
<td>
从
  <div class="datepicker input-append">
    <input data-format="yyyy-MM-dd" type="text" value="${beginDate}" name="beginDate"></input>
    <span class="add-on">
      <i data-time-icon="icon-time" data-date-icon="icon-calendar">
      </i>
    </span>
  </div>
</td>
<td>
  	到
  <div class="datepicker input-append">
    <input data-format="yyyy-MM-dd" type="text" value="${endDate}" name="endDate"></input>
    <span class="add-on">
      <i data-time-icon="icon-time" data-date-icon="icon-calendar">
      </i>
    </span>
  </div>
  </td>
  <td>
  	金钱类型：
</td>
<td>
  <div class="controls">
  		<select id="moneyType" name="moneyType">
			<option value="1">K币</option>
			<option value="2">分贝</option>
		</select>
  </div>
</td>
<td>
  <input type="hidden" name="isFirst" value="1">
  <button type="submit" class="btn">查询</button>
</td>
</tr>
</table>
</form>
<table class="table table-bordered">
  <thead>
    <tr>
      <th>类型</th>
      <c:if test="${moneyType  == 1}">
      <th>产出K币</th>
      <th>回收K币(K歌房)</th>
      <th>回收K币(活动房)</th>
      </c:if>
      <c:if test="${moneyType  == 2}">
      <th>产出分贝</th>
      <th>回收分贝(K歌房)</th>
      <th>回收分贝(活动房)</th>
      </c:if>
    </tr>
  </thead>
  <tbody>
  <c:set var="goldOutAll" value="0"/>
  <c:set var="kbarGoldInAll" value="0"/>
  <c:set var="actGoldInAll" value="0"/>
  <c:set var="silverOutAll" value="0"/>
  <c:set var="kbarSilverInAll" value="0"/>
  <c:set var="actSilverInAll" value="0"/>
  <c:set var="starAll" value="0"/>
  <c:forEach var="m" items="${deTailList}">
    <tr>
      <td>${m.type}</td>
      <c:if test="${moneyType  == 1}">
      <td>${m.systemGoldOut}</td>
      <c:set var="goldOutAll" value="${goldOutAll +  m.systemGoldOut}"/>
      <td>${m.systemGoldIn.kbarIn}</td>
      <c:set var="kbarGoldInAll" value="${kbarGoldInAll +  m.systemGoldIn.kbarIn}"/>
      <td>${m.systemGoldIn.actionIn}</td>
      <c:set var="actGoldInAll" value="${actGoldInAll +  m.systemGoldIn.actionIn}"/>
      </c:if>
      <c:if test="${moneyType  == 2}">
      <td>${m.systemSilverOut}</td>
      <c:set var="silverOutAll" value="${silverOutAll + m.systemSilverOut}"/>
      <td>${m.systemSilverIn.kbarIn}</td>
      <c:set var="kbarSilverInAll" value="${kbarSilverInAll +  m.systemSilverIn.kbarIn}"/>
      <td>${m.systemSilverIn.actionIn}</td>
      <c:set var="actSilverInAll" value="${actSilverInAll +  m.systemSilverIn.actionIn}"/>
      </c:if>
      <c:if test="${m.type =='积分爆星' }">
      	<c:set var="starAll" value="${starAll +  m.systemSilverOut}"/>
      </c:if>
       <c:if test="${m.type =='积分爆小星星' }">
      	<c:set var="starAll" value="${starAll +  m.systemSilverOut}"/>
      </c:if>
    </tr>
  </c:forEach>
   <tr>
      <td><font color="red">合计</font></td>
      <c:if test="${moneyType  == 1}">
      <td><c:out value="${goldOutAll}"/></td>
      <td><c:out value="${ kbarGoldInAll}"/></td>
      <td><c:out value="${ actGoldInAll}"/></td>
      </c:if>
      <c:if test="${moneyType  == 2}">
      <td><c:out value="${silverOutAll }"/></td>
      <td><c:out value="${ kbarSilverInAll}"/></td>
      <td><c:out value="${ actSilverInAll}"/></td>
      </c:if>
    </tr>
    <c:if test="${moneyType  == 2}">
	    <tr>
	    	<td>积分爆星星总和</td>
	    	<td><c:out value="${starAll}"/></td>
	      	<td><c:out value="0"/></td>
	      	<td><c:out value="0"/></td>
	    </tr>
    </c:if>
    
  </tbody>
</table>

</body>
</html>